<template>
  <el-container>
    <basic-crud :option="option" businessUrl="/mes/workAntivirusRecordController">
      <template #menu="{ row, size }">
        <el-button
            type="text"
            icon="el-icon-view"
            @click="handleView(row)"
        >查看
        </el-button>
      </template>
    </basic-crud>
    <antivirus-records-form
        ref="antivirusRecordsFormRefs"
        @refresh="refreshHandler"
    ></antivirus-records-form>
  </el-container>
</template>

<script setup>
import { formatDate } from "@/utils/formatTime";
import AntivirusRecordsForm from "@/views/mes/techne/AntivirusRecordsForm.vue";
import {ref} from "vue";
const option = ref({
  addBtn:false,
  editBtn:false,
  viewBtn:false,
  delBtn:false,
  menuWidth:80,
  column:[
    {
      label: "产品型号",
      type: "input",
      prop: "modelName", //
      sortable: true, //排序
      rules: [],
      search: true,
      searchType: "input",
    },
    {
      label: "产品名称",
      type: "input",
      prop: "productName",
      sort: true,
      search: true,
    },
    {
      label: "产品编号",
      type: "input",
      prop: "productCode",
      sort: true,
      search: true,
    },
    {
      label: "规程编号",
      type: "input",
      prop: "code",
      search: true,
      sort: true,
      width: 150,
    },
    {
      label: "规程名称",
      type: "input",
      prop: "name",
      search: true,
      sort: true,
    },
    {
      label: "来源",
      type: "input",
      prop: "source",
      sort: true,
      width: 150,
    },{
      prop: 'sourceTime',
      label:'来源时间',
      sort: true,
      width: 100,
      formatter: (row) => {
        return row.sourceTime?.substring(0, 10) || "";
      },
    },
    {
      prop: "softwareAndVersion",
      label: "防病毒软件及版本",
      width: 200,
      display: false,
      hide:true
    },
    {
      prop: "toxic",
      label: "查杀处理是否有毒",
      width: 200,
      display: false,
      hide:true,
      formatter: (row) => {
        return row.toxic == true ? '是' : '否';
      }
    },
    {
      prop: "antivirusTime",
      label: "查杀处理时间",
      width: 200,
      display: false,
      formatter: (row) => {
        return row.antivirusTime?.substring(0, 10) || "";
      },
      hide:true,
    },
    {
      prop: "doResult",
      label: "查杀病毒结果(包括病毒名，文件名及数量等)",
      width: 200,
      display: false,
      column:false,
      hide:true,
    },
    {
      prop: "processedUserName",
      label: "处理人",
      width: 200,
      display: false,
      hide:true,
    },
    {
      prop: "inspectorName",
      label: "检验人",
      width: 200,
      display: false,
      hide:true,
    },
    {
      prop: "representativeName",
      label: "用户代表",
      width: 200,
      display: false,
      hide:true,
    },
  ]
})

const antivirusRecordsFormRefs=ref(null);
const handleView=(row) =>{
  const params = {
    type: "view",
    row: row,
  };
  antivirusRecordsFormRefs.value?.openDialog(params);
}
</script>

<style lang="scss" scoped>

</style>
